﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using AnalyseCrmMana;

namespace AnalyseCRM.InteractiveData
{
    public partial class LogOnAjax : System.Web.UI.Page
    {
        private string _paramValue = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request["paramvalue"] != null)
            {
                _paramValue = Server.UrlDecode(Request["paramvalue"].ToString());
            }
            Response.Write(buildHtml(_paramValue));
        }

        public StringBuilder buildHtml(string prparamValue)
        {
            StringBuilder returnValue = new StringBuilder();
            AccountMana acmana = new AccountMana();
            if (acmana.LogOning(prparamValue.Split('|')[0],prparamValue.Split('|')[1]))
            {
                CurSessionUser.curUser = prparamValue.Split('|')[0];
                returnValue.Append("SUCCESS");
            }
            else
            {
                returnValue.Append("LOGERROR");
            }
            return returnValue;

        }
    }
}